package com.service.impl;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.dao.AdminDao;
import com.dto.EmpInfo;
import com.dto.Role;
import com.service.AdminService;
import com.util.FenYe;
import com.util.PageUtil;
import com.util.Query;
@Service
public class AdminServiceImpl implements AdminService {
	@Autowired
	private AdminDao ad;
	@Override//员工登录
	public EmpInfo queryEmp(EmpInfo emp) {
		return ad.queryEmp(emp);
	}
	@Override//员工查询带分页
	public List<EmpInfo> queryEmpByFy(FenYe fy) {
		List<EmpInfo> emps=null;
		try {
			if(fy.getPage()==null) {
				fy.setPage(1);
			}
			Query query=fy.getQuery();
			int a =ad.queryRowCount(query);
			fy.setRowCount(a);
			 emps=ad.queryEmpByFy(fy);
		} catch (Exception e) {
				e.printStackTrace();
		}
		return emps;
	}
	
	@Override//查询员工职位
	public List<Role> queryRole(Role role) {
		// TODO Auto-generated method stub
		return ad.queryRole(role);
	}
	@Override//添加员工
	public int addEmp(EmpInfo emp) {
		// TODO Auto-generated method stub
		return ad.addEmp(emp);
	}
	@Override//查询员工详细信息
	public EmpInfo queryEmpByIds(String ids) {
		// TODO Auto-generated method stub
		return ad.queryEmpByIds(ids);
	}
	@Override//修改i员工信息
	public int updateEmp(EmpInfo emp) {
		// TODO Auto-generated method stub
		return ad.updateEmp(emp);
	}
	@Override//根据ID删除员工信息
	public int deleteEmp(List<String> idss) {
		// TODO Auto-generated method stub
		return ad.deleteEmp(idss);
	}
	@Override//验证用户名是否存在
	public EmpInfo queryEmpByAdd(EmpInfo emp) {
		
		return ad.queryEmpByAdd(emp);
	}

}
